import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../pages/login/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: HomeView,
    },
    {
      path: '/visual',
      name: 'visual',
      component: () => import('../pages/visuals/index.vue'),
    },
    {
      path: '/admin',
      name: 'admin',
      redirect: '/admin/index',
      component: () => import('../components/admin/layout/index.vue'),
      children: [
        {
          path: '/admin/index',
          name: 'index',
          meta: {name: '首页'},
          component: () => import('../pages/admins/index/index.vue'),
        },
        {
          path: '/admin/setting',
          name: 'setting',
          meta: {name: '设置'},
          component: () => import('../pages/admins/setting/index.vue'),
        }
      ]
    },
  ],
})

export default router
